<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <input v-model="num" type="text" />
        <button v-on:click="addNum()">登录</button>
        <button v-on:click="reduceNum()">登出</button>
        <h1>{{name}}，欢迎您，登录次数:{{num}}次,当前登录时间：{{nowDate()}}</h1>
     </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    
    <script>
     ///new vue实例
       new Vue({
            el: "#app",
            // data:{
            //     name: "李四刚"
            // }
            data() {
                return {
                    name:"猪猪侠",
                    num:0
                }
            },
            methods: {
                nowDate(){
                    return new Date().toLocaleDateString()
                },
                addNum(){
                    return this.num++;
                },
                reduceNum(){
                    return this.num=this.num-1;
                }
            },
        })
    </script>
</body>
</html>